//
//  DYMassageDataManager.swift
//  Chatup
//
//  Created by op on 2023/10/17.
//

import Foundation
import WCDBSwift
import KakaJSON

class MassageDataManager{
    static let share = MassageDataManager()
    
    func getMsg(roleId:Int) ->[MsgModel] {
        let models = ChatUpWCDBWrapLoader.share.qureyFromDbArray(ttype: MsgModel.self,where: MsgModel.Properties.roleId.is(roleId),orderBy: [MsgModel.Properties.createTime])
        return models ?? []
    }
    
    func saveMsg(msg:MsgModel) {
        ChatUpWCDBWrapLoader.share.insertToDb(object: msg)
    }
    func saveMsgs(msgs:[MsgModel]) {
        ChatUpWCDBWrapLoader.share.insertToDbArray(objects: msgs)
    }
}
